home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
comm
/
net
/
spakparnet_0_5.lha
/
han
/
act_waitchar.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-09
|
3KB
|
91 lines
/********************************************************************
** NETWORK FILESYSTEM - DOS HANDLER
**
** (c) Spak, Darrell Tam, c9107253@ee.newcastle.edu.au (1994)
** phone (Australia) 049-829-710
** 49-829-710
** (c) SST 1994
**
** WAITCHAR
**
** TABS to 4
********************************************************************/
#include "/snd/everything.h"
#include "deadheads.h"
#include "root_protos.h"
#include "globs_protos.h"
#include "xtra_protos.h"
#define WAITCHAR_PKTMSG_SIZE (sizeof(struct WaitCharPktMsg))
/** another variation of the "doofus" for waitcharing */
struct WaitCharPktMsg {
struct DoofusPktMsg dpm;
struct NFSWaitChar waitcharreq; /* request packet struct */
struct NFSStdReturn waitcharret; /* what the server sends back */
};
#define WAITCHAR_PKTMSG_SIZE (sizeof(struct WaitCharPktMsg))
/********************************************************************/
static long handle_waitchar_net(struct WaitCharPktMsg *spm)
/********************************************************************/
{
struct DosPacket *dosmsg = spm->dpm.dp_original;
dosmsg->dp_Res1 = spm->waitcharret.remote_res1;
dosmsg->dp_Res2 = spm->waitcharret.remote_res2;
if(spm->dpm.net.pm.smsg.result != PAR_OK)
{ dosmsg->dp_Res1 = 0; dosmsg->dp_Res2 = ERROR_NO_DISK; }
return(AR_FLAG_RETURNDOSMSG | AR_FLAG_FREEDOOF);
}
/********************************************************************/
long action_wait_char(struct DosPacket *dosmsg,
struct MsgPort *dm_retport)
/********************************************************************/
{ /* timeout, arg1 : actual length */
struct FileArg1 *fa1 = (void *)dosmsg->dp_Arg2; /* <-- reversed! */
struct WaitCharPktMsg *spm;
{ unsigned char tt[100]; spf(tt,100,"fa1=%lx, timeout=%ld",
dosmsg->dp_Arg2, dosmsg->dp_Arg1); MyPrint(win1, tt);
}
/** CHECK THIS FILE ARG1 */
if(!fa1) {
dosmsg->dp_Res1 = 0; dosmsg->dp_Res2 = ERROR_INVALID_LOCK;
return(AR_FLAG_RETURNDOSMSG);
}
/** SEND OFF TO THE REMOTE MACHINE */
if(!(spm = AllocMem(WAITCHAR_PKTMSG_SIZE, MEMF_PUBLIC))) {
dosmsg->dp_Res1 = 0; dosmsg->dp_Res2 = ERROR_NO_FREE_STORE;
return(AR_FLAG_RETURNDOSMSG);
}
spm->waitcharreq.request = REQUEST_WAITCHAR;
spm->waitcharreq.remote_ifh = fa1->remote.remote_ifh;
spm->waitcharreq.remote_majic = fa1->remote.majic;
spm->waitcharreq.timeout = dosmsg->dp_Arg1; /* note; NOT ARG2!! */
INIT_DOOFPKTMSG(&spm->dpm,
handle_waitchar_net, /* our routine to call */
netrepport,
dosmsg, dm_retport, /* original stuff */
WAITCHAR_PKTMSG_SIZE,
fa1->remote.machine, fa1->remote.service,
&spm->waitcharreq, sizeof(struct NFSWaitChar), /* net-service-request */
NULL, 0, /* send-body */
NULL, 0, /* result-body */
&spm->waitcharret, sizeof(struct NFSStdReturn));
/* return stuff */
PutMsg(NET_SERV_PORT(fa1), spm);
return(0);
}